package com.example.tests;

public class ContactData implements Comparable<ContactData> {
	
	private String firstName;
	private String lastName;
	private String firstAddress;
	private String firstHome;
	private String mobile;
	private String work;
	private String firstEmail;
	private String secondEmail;
	private String secondAddress;
	private String secondHome;
	private String birthDay;
	private String month;
	private String year;
	private String group;

	public ContactData() {
	}
	
	public ContactData(String first_name, String last_name, String address_1,
			String home_1, String mobile, String work, String email_1,
			String email_2, String address_2, String home_2, String first,
			String month, String year, String group) {
		this.firstName = first_name;
		this.lastName = last_name;
		this.firstAddress = address_1;
		this.firstHome = home_1;
		this.mobile = mobile;
		this.work = work;
		this.firstEmail = email_1;
		this.secondEmail = email_2;
		this.secondAddress = address_2;
		this.secondHome = home_2;
		this.birthDay = first;
		this.month = month;
		this.year = year;
		this.group = group;
	}

	@Override
	public String toString() {
		return "ContactData [firstName=" + firstName + ", lastName=" + lastName
				+ ", firstAddress=" + firstAddress + ", firstHome=" + firstHome
				+ ", mobile=" + mobile + ", work=" + work + ", firstEmail="
				+ firstEmail + ", secondEmail=" + secondEmail
				+ ", secondAddress=" + secondAddress + ", secondHome="
				+ secondHome + ", birthDay=" + birthDay + ", month=" + month
				+ ", year=" + year + ", group=" + group + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		//result = prime * result
		//		+ ((firstName == null) ? 0 : firstName.hashCode());
		//result = prime * result
		//		+ ((lastName == null) ? 0 : lastName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactData other = (ContactData) obj;
		if (firstName == null) {
			if (other.firstName != null)
				return false;
		} else if (!firstName.equals(other.firstName))
			return false;
		if (lastName == null) {
			if (other.lastName != null)
				return false;
		} if (lastName.equals(other.getLastName())  && firstName.equals(other.getFirstName())) {
            return true;
        }
        return false;
	}

	@Override
	public int compareTo(ContactData other) {
		return this.firstName.toLowerCase().compareTo(other.firstName.toLowerCase());
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
		
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;	
	}
	
	public ContactData withFirstName (String firstName) {
		this.firstName = firstName;
		return this;
	}
	
	public ContactData withLastName (String lastName) {
		this.lastName = lastName;
		return this;
	}
	
	public ContactData withFirstAddress (String firstAddress) {
		this.firstAddress = firstAddress;
		return this;
	}
	
	public ContactData withFirstHome (String firstHome) {
		this.firstHome = firstHome;
		return this;
	}
	
	public ContactData withMobile (String mobile) {
		this.mobile = mobile;
		return this;
	}
	
	public ContactData withWork (String work) {
		this.work = work;
		return this;
	}
	
	public ContactData withFirstEmail (String firstEmail) {
		this.firstEmail = firstEmail;
		return this;
	}
	
	public ContactData withSecondEmail (String secondEmail) {
		this.secondEmail = secondEmail;
		return this;
	}
	
	public ContactData withSecondAddress (String secondAddress) {
		this.secondAddress = secondAddress;
		return this;
	}
	
	public ContactData withSecondHome (String secondHome) {
		this.secondHome = secondHome;
		return this;
	}
	
	public ContactData withYear (String year) {
		this.year = year;
		return this;
	}

	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}
	
	public void setSecondAddress(String secondAddress) {
		this.secondAddress = secondAddress;
	}

	public void setSecondHome(String secondHome) {
		this.secondHome = secondHome;
	}

	public String getFirstAddress() {
		return firstAddress;
	}

	public String getFirstHome() {
		return firstHome;
	}

	public String getMobile() {
		return mobile;
	}

	public String getWork() {
		return work;
	}

	public String getFirstEmail() {
		return firstEmail;
	}

	public String getSecondEmail() {
		return secondEmail;
	}

	public String getSecondAddress() {
		return secondAddress;
	}

	public String getSecondHome() {
		return secondHome;
	}

	public String getBirthDay() {
		return birthDay;
	}

	public String getMonth() {
		return month;
	}

	public String getYear() {
		return year;
	}

	public String getGroup() {
		return group;
	}
}
